//
//  DestinationCollectionViewCell.m
//  God_is_a_Girl
//
//  Created by dllo on 15/9/24.
//  Copyright (c) 2015年 呸. All rights reserved.
//

#import "DestinationCollectionViewCell.h"
#import <UIImageView+WebCache.h>

@implementation DestinationCollectionViewCell

//从写初始化方法 目的:子视图初始化 //继承原来的东西 赋予新的东西
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super  initWithFrame:frame];
    if (self) {
        self.cover_route_map_cover = [[UIImageView  alloc] init];
        [self.contentView  addSubview:self.cover_route_map_cover];
        
        self.name = [[UILabel  alloc] init];
        [self.contentView  addSubview:self.name];
        
    }
    
    return self;
    
}

-(void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    [super  applyLayoutAttributes:layoutAttributes];
    self.cover_route_map_cover.frame = CGRectMake(0, 0,self.frame.size.width ,self.frame.size.height);
    self.name.frame = CGRectMake(10, self.frame.size.width-90,self.frame.size.width, 50);
}

// 目的:给子控件赋值
-(void)setModel:(DestinationModel *)model
{
    //子控件赋值
    [self.cover_route_map_cover  sd_setImageWithURL:[NSURL  URLWithString:model.cover_route_map_cover]placeholderImage:[UIImage  imageNamed:@"1436964361872.jpg"]];
    self.cover_route_map_cover.layer.cornerRadius = 8;
    self.cover_route_map_cover.layer.masksToBounds = YES;
    
    self.name.text = model.name;
    self.name.font = [UIFont  systemFontOfSize:15];
    [self.name  setTextColor:[UIColor  whiteColor]];
   
}







@end
